﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
    
    <Style x:Key="RadioButtonFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <!--<Rectangle Margin="14,0,0,0"
                               StrokeThickness="1"
                               Stroke="Black"
                               StrokeDashArray="1 2"
                               SnapsToDevicePixels="true"/>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="{x:Type RadioButton}" TargetType="{x:Type RadioButton}">
        <Setter Property="Foreground" Value="{DynamicResource RadioButtonForeground}" />
        <Setter Property="Background" Value="#F4F4F4" />
        <Setter Property="BorderBrush" Value="{DynamicResource CheckBoxStrokeNormalKey}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <StackPanel Background="Transparent" Orientation="Horizontal" UseLayoutRounding="False" SnapsToDevicePixels="True">
                        <Grid>
                            <Ellipse x:Name="OuterRectangle" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"
                                    Height="13" Width="13" />
                            <Ellipse x:Name="InnerRectangle" Fill="{TemplateBinding Background}" Height="7" Width="7"
                                    Visibility="{TemplateBinding IsChecked, Converter={StaticResource booleanToVisibilityConverter}}" />
                        </Grid>
                        <ContentPresenter Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" Value="{StaticResource RadioButtonFocusVisual}" />
                            <Setter Property="Padding" Value="4,0,0,0" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="OuterRectangle" Property="Stroke"
                                    Value="{DynamicResource CheckBoxStrokeHotKey}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>